//
//  DetailForBuildTableViewController.m
//  uplife
//
//  Created by ZhangCheng on 2019/1/29.
//  Copyright © 2019年 ZhangCheng. All rights reserved.
//

#import "DetailForBuildTableViewController.h"
#import <BaiduMapAPI_Base/BMKBaseComponent.h>//引入base相关所有的头文件
#import <BaiduMapAPI_Map/BMKMapComponent.h>//引入地图功能所有的头文件

@interface DetailForBuildTableViewController ()<UIGestureRecognizerDelegate>{
//    BMKMapView *_mapView;
}
@property (weak, nonatomic) IBOutlet UILabel *gouRuJiaGeLabel;
@property (weak, nonatomic) IBOutlet UILabel *biaoMianHuiBaoLvLabel;
@property (weak, nonatomic) IBOutlet UILabel *jianZhuNianFenLabel;
@property (weak, nonatomic) IBOutlet UILabel *gouZaoLabel;
@property (weak, nonatomic) IBOutlet UILabel *louCengLabel;
@property (weak, nonatomic) IBOutlet UILabel *tuDiMianJiLabel;
@property (weak, nonatomic) IBOutlet UILabel *jianZhuMianJiLabel;
@property (weak, nonatomic) IBOutlet UILabel *jianZhuLvLabel;
@property (weak, nonatomic) IBOutlet UILabel *rongJiLvLabel;
@property (weak, nonatomic) IBOutlet UILabel *diYuYongTuLabel;
@property (weak, nonatomic) IBOutlet UILabel *huoZaiXianLabel;
@property (weak, nonatomic) IBOutlet UILabel *diZhiLabel;

@property(nonatomic,strong)IBOutlet UIView *mapViewSuperView;

@end

@implementation DetailForBuildTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
//    self.gouRuJiaGeLabel.text = [NSString stringWithFormat:@"%@(%@%@)",self.fatherViewController.dataDic[@"JbuyPrice"],[ZCTool sharedInstance].currentSelectedHuoBiDic[@"code"],self.fatherViewController.dataDic[@"buyPrice"]];
    self.gouRuJiaGeLabel.text = [NSString stringWithFormat:@"%@万円",FORMAT_PRICE(self.fatherViewController.dataDic[@"JbuyPrice"])];
//    NSMutableAttributedString* string = [[NSMutableAttributedString alloc] initWithString:self.gouRuJiaGeLabel.text attributes:@{NSFontAttributeName: self.gouRuJiaGeLabel.font,NSForegroundColorAttributeName: self.gouRuJiaGeLabel.textColor}];
//
//    [string addAttributes:@{NSForegroundColorAttributeName: [UIColor colorWithRed:136/255.0 green:138/255.0 blue:143/255.0 alpha:1.0]} range:[self.gouRuJiaGeLabel.text rangeOfString:[NSString stringWithFormat:@"(%@%@)",[ZCTool sharedInstance].currentSelectedHuoBiDic[@"code"],self.fatherViewController.dataDic[@"buyPrice"]]]];
//    self.gouRuJiaGeLabel.attributedText = string;
    
    NSNumber *returnRate = self.fatherViewController.dataDic[@"returnRate"];
    self.biaoMianHuiBaoLvLabel.text = [NSString stringWithFormat:@"%.0f%%",returnRate.floatValue];
    self.jianZhuNianFenLabel.text = [NSString stringWithFormat:@"%@",self.fatherViewController.dataDic[@"buildDate"]];
    self.gouZaoLabel.text = [NSString stringWithFormat:@"%@",self.fatherViewController.dataDic[@"structureValue"]];
    self.louCengLabel.text = [NSString stringWithFormat:@"%@层",self.fatherViewController.dataDic[@"floor"]];
    self.tuDiMianJiLabel.text = [NSString stringWithFormat:@"%@㎡",self.fatherViewController.dataDic[@"landArea"]];
    self.jianZhuMianJiLabel.text = [NSString stringWithFormat:@"%@㎡",self.fatherViewController.dataDic[@"buildArea"]];
    NSNumber *buildRate = self.fatherViewController.dataDic[@"buildRate"];
    self.jianZhuLvLabel.text = [NSString stringWithFormat:@"%.0f%%",buildRate.floatValue];
    NSNumber *plotRate = self.fatherViewController.dataDic[@"plotRate"];
    self.rongJiLvLabel.text = [NSString stringWithFormat:@"%.0f%%",plotRate.floatValue];
    self.diYuYongTuLabel.text = [NSString stringWithFormat:@"%@",self.fatherViewController.dataDic[@"areaUse"]];
    
    self.huoZaiXianLabel.text = [NSString stringWithFormat:@"%@",self.fatherViewController.dataDic[@"insure"]];
    self.diZhiLabel.text = [NSString stringWithFormat:@"%@",self.fatherViewController.dataDic[@"buildingAddress"]];
    
//    _mapView = [[BMKMapView alloc]initWithFrame:CGRectMake(self.mapViewSuperView.frame.origin.x, self.mapViewSuperView.frame.origin.y, [UIScreen mainScreen].bounds.size.width, self.mapViewSuperView.frame.size.height)];
//    _mapView.delegate = self;
//    _mapView.rotateEnabled = NO;
//    //    _mapView.zoomEnabled
//    //    _mapView.gesturesEnabled=YES;
//    [self.mapViewSuperView addSubview:_mapView];
    
    UIGestureRecognizer *gestur = [[UIGestureRecognizer alloc]init];
    gestur.delegate=self;
    [self.fatherViewController.scrollView addGestureRecognizer:gestur];
    
    //    UIGestureRecognizer *gestur2 = [[UIGestureRecognizer alloc]init];
    //    gestur2.delegate=self;
    //    [self.tableView addGestureRecognizer:gestur2];
    
    
//    UIGestureRecognizer *gestur1 = [[UIGestureRecognizer alloc]init];
//    gestur1.delegate=self;
//    [_mapView addGestureRecognizer:gestur1];
    
    
    
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
    
//    if ([gestureRecognizer.view isKindOfClass:[BMKMapView class]]) {
//        self.fatherViewController.scrollView.scrollEnabled=NO;
//        self.tableView.scrollEnabled = NO;
//    }else{
        self.fatherViewController.scrollView.scrollEnabled=YES;
        self.tableView.scrollEnabled = YES;
//    }
    
    return NO;
}
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
//    [_mapView viewWillAppear];
}
-(void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
//    [_mapView viewWillDisappear];
}

-(void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
//    BMKPointAnnotation* annotation = [[BMKPointAnnotation alloc]init];
//    annotation.coordinate = CLLocationCoordinate2DMake(((NSNumber*)self.fatherViewController.dataDic[@"latitude"]).doubleValue, ((NSNumber*)self.fatherViewController.dataDic[@"longitude"]).doubleValue);
//    annotation.title = self.fatherViewController.dataDic[@"buildingName"];
//    [_mapView addAnnotation:annotation];
//
//    [_mapView setRegion:BMKCoordinateRegionMake(annotation.coordinate, BMKCoordinateSpanMake(0.05, 0.05))];
}
//- (BMKAnnotationView *)mapView:(BMKMapView *)mapView viewForAnnotation:(id <BMKAnnotation>)annotation
//{
//    if ([annotation isKindOfClass:[BMKPointAnnotation class]]) {
//        static NSString *pointReuseIndentifier = @"pointReuseIndentifier";
//        BMKPinAnnotationView*annotationView = (BMKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:pointReuseIndentifier];
//        if (annotationView == nil) {
//            annotationView = [[BMKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:pointReuseIndentifier];
//        }
//        annotationView.pinColor = BMKPinAnnotationColorPurple;
//        annotationView.canShowCallout= YES;      //设置气泡可以弹出，默认为NO
//        //        annotationView.animatesDrop=YES;         //设置标注动画显示，默认为NO
//        //        annotationView.draggable = YES;          //设置标注可以拖动，默认为NO
//        return annotationView;
//    }
//    return nil;
//}
/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
